<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>math概述</title>
    <script>
        // 1.绝对值方法
        console.log(Math.abs(1));//1
        console.log(Math.abs(-1));//1
        console.log(Math.abs('-1'));//隐式转换 会把字符串型 -1 转化为数字型
        console.log(Math.abs('pink'));//NaN

        //2.三个取整方法
        //(1) 往下取整  往最小了取值
        console.log(Math.floor(1.4));//1
        console.log(Math.floor(2.9));//2


        //(2) 往上取整  往最大了取值
        console.log(Math.ceil(1.4));//2
        console.log(Math.ceil(2.9));//3

        //(1) 四舍五入  .5是特殊的他往大了取
        console.log(Math.round(1.4));//1
        console.log(Math.round(2.9));//3
        console.log(Math.round(-1.5));// -1  所以这个是-1
    </script>
</head>
<body>
    
</body>
</html>